package com.ncloud.act.service.impl;

import java.util.List;

import javax.annotation.Resource;

import com.alibaba.dubbo.config.annotation.Service;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.ncloud.common.exception.UserException;
import com.ncloud.act.common.ActDataHelper;
import com.ncloud.act.entity.PayLog;
import com.ncloud.act.mapper.PayLogMapper;
import com.ncloud.act.service.PayLogService;

@Service(retries=-1,timeout=6000)
public class PayLogServiceImpl implements PayLogService{
	@Resource
	private PayLogMapper mapper;
	
	public JSONArray getPayLogByAcctID(JSONObject json){
		if(!json.containsKey("acct_id"))
			throw new UserException("2001", "传入参数有误");
		Long acctID = json.getLong("acct_id");
		List<PayLog> dicts = mapper.getPayLogByAcctID(acctID);
		JSONArray results=JSON.parseArray(JSON.toJSONString(dicts));
		ActDataHelper.div100(results, new String[] { "recv_fee","rsrv_fee1"});
		return results;
	}
}
